/*
 * $Id: IFTCommand.java,v 1.4 2012/01/30 15:52:15 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.commands;

import com.ge.healthcare.autosc.common.exceptions.FTPCommandException;
import com.ge.healthcare.autosc.common.exceptions.InvalidLoginCredentialsException;
import com.ge.healthcare.autosc.common.exceptions.SFTPCommandException;

/**
 * @author 212042764
 * 
 */
public interface IFTCommand {
	public static final String ALL_PERMISSIONS = "7";
	public static final String READ_EXECUTE_PERMISSIONS = "5";
	public static final String READ_PERMISSIONS = "4";
	public static final String READ_WRITE_PERMISSIONS = "6";

	/**
	 * Used to performing login to remote server
	 * 
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 * @throws InvalidLoginCredentialsException
	 */
	public abstract void login(String host, String userName, String passcode)
			throws FTPCommandException, SFTPCommandException,
			InvalidLoginCredentialsException;

	/**
	 * Used for loggin out of remote server
	 * 
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract void logout() throws FTPCommandException,
			SFTPCommandException;

	/**
	 * Transfer local file to the remote location on the FTP/SFTP Server
	 * 
	 * @param localFile
	 * @param remoteFile
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract void putFile(String localFile, String remoteFile)
			throws FTPCommandException, SFTPCommandException;

	/**
	 * Method used to retrieve the remote file
	 * @param remoteFile
	 * @param localFile
	 * @throws FTPCommandException
	 */
	public abstract void getFile(String remoteFile, String localFile)
		throws FTPCommandException, SFTPCommandException;
	
	/**
	 * Makes the specified directory on the remote server
	 * 
	 * @param pathname
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract void mkdir(String pathname) throws FTPCommandException,
			SFTPCommandException;

	/**
	 * Renames the file on the remote server
	 * 
	 * @param oldName
	 * @param newName
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract void mv(String oldName, String newName)
			throws FTPCommandException, SFTPCommandException;

	/**
	 * Prints current working directory on the remote server
	 * 
	 * @return
	 * @throws FTPCommandException
	 */
	public abstract String pwd() throws FTPCommandException;

	/**
	 * Change directory on the remote server
	 * 
	 * @param pathname
	 * @return
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract boolean cd(String pathname) throws FTPCommandException,
			SFTPCommandException;

	/**
	 * Change directory on the remote server and throws exception if fail to do
	 * so
	 * 
	 * @param pathname
	 * @param throwException
	 * @return
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract boolean cd(String pathname, boolean throwException)
			throws FTPCommandException, SFTPCommandException;

	/**
	 * Displays the local directory on the local machine
	 * 
	 * @param pathname
	 * @return
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public abstract boolean lcd(String pathname) throws FTPCommandException,
			SFTPCommandException;

	/**
	 * Sets file transfer mode
	 * 
	 * @param mode
	 * @throws FTPCommandException
	 */
	public abstract void setTransferMode(int mode) throws FTPCommandException,
			SFTPCommandException;

	/**
	 * Sets file transfer mode as binary
	 * @throws FTPCommandException
	 */
	public abstract void setBinaryTransferMode() throws FTPCommandException;
	
	/**
	 * Runs chmod on remote server
	 * 
	 * @param ownerPermission
	 * @param staffPermission
	 * @param othersPermission
	 * @param path
	 * @throws FTPCommandException
	 * @throws SFTPCommandException
	 */
	public void chmod(String ownerPermission, String staffPermission,
			String othersPermission, String path) throws FTPCommandException,
			SFTPCommandException;
}
